package cloud.maque.querylist.domain.impl;

import cloud.maque.querylist.dal.domain.entity.Room;
import cloud.maque.querylist.dal.interfaces.RoomService;
import cloud.maque.querylist.domain.interfaces.BusinessService;
import cloud.maque.querylist.domain.request.BusinessRequest;
import cloud.maque.querylist.domain.response.BusinessResponse;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhuyf
 * @date 2022/6/28 16:02
 */

@Service
public class BusinessServiceImpl implements BusinessService {


    @Autowired
    RoomService roomService;

    @Override
    public String Hello(String name) {
        return "你好：" + name;
    }

    @Override
    public BusinessResponse SaveDb(BusinessRequest request) {
        List<Room> rooles = roomService.roomList();
        String result = request.getName() + ":你得到的数据是：" + JSON.toJSONString(rooles);
        BusinessResponse response = new BusinessResponse();
        response.setResult(result);
        return response;
    }
}
